package com.picket.domain;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

public class GaeUser implements Serializable {
	
	private static final long serialVersionUID = -1595990757561334686L;
	
	private String userId;
	private String email;
	private String nickname;
	private String firstname;
	private String lastname;
	private Set<AppRole> authorities;
	private boolean enabled;
	
	public GaeUser(String userId, String email, String nickname){
		this.userId = userId;
		this.email = email;
		this.nickname = nickname;
	}
	
	public GaeUser(
            String userId, String email, String nickname, String forename,String surname,Set<AppRole> roles,boolean enabled){
		this.userId = userId;
		this.email = email;
		this.nickname = nickname;
		this.firstname = forename;
		this.lastname = surname;
		this.authorities = roles;
		this.enabled = enabled;
	}

	
	public String getUserId() {
		return userId;
	}


	public void setUserId(String userId) {
		this.userId = userId;
	}


	public String getEmail() {
		return email;
	}


	public void setEmail(String email) {
		this.email = email;
	}


	public String getNickname() {
		return nickname;
	}


	public void setNickname(String nickname) {
		this.nickname = nickname;
	}


	public String getFirstname() {
		return firstname;
	}


	public void setFirstname(String forename) {
		this.firstname = forename;
	}


	public String getLastname() {
		return lastname;
	}


	public void setLastname(String surname) {
		this.lastname = surname;
	}


	public Set<AppRole> getAuthorities() {
		return authorities;
	}


	public void setAuthorities(Set<AppRole> authorities) {
		this.authorities = authorities;
	}


	public boolean isEnabled() {
		return enabled;
	}


	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public void addAuthority(AppRole role) {
		if(this.authorities == null){
			this.authorities = new HashSet<AppRole>();
		}
		this.authorities.add(role);
	}
	
	public String getName(){
		return this.getFirstname()+" "+this.getLastname();
	}
	
}